package com.crop.back.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.crop.back.common.enums.Deleted;
import com.crop.back.common.utils.ResultBean;
import com.crop.back.entity.Role;
import com.crop.back.service.RoleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import javax.annotation.Resource;

/**
 * <p>
 * 角色表 前端控制器
 * </p>
 *
 * @author 作者
 * @since 2025-01-20
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Resource
    private RoleService roleService;

    @GetMapping("/list")
    public ResultBean getAll() {
        List<Role> roleList = roleService.list(new LambdaQueryWrapper<Role>()
                .eq(Role::getDeleted, Deleted.NOT_DELETED.getCode()));
        return ResultBean.ok(roleList);
    }
}
